import React , { useCallback } from 'react';
import {IconStyle} from './styledIcon'
import { string,func } from 'prop-types'


import * as icon from '@/assets/svg/icon'
export default function Icon({
    name,
    color,
    size,
    bgColor,
    type,
    padding,
    click
}) {
    return (
        <IconStyle
            size={size}
            color={color}
            bgColor={bgColor}
            type={type}
            padding={padding}
            onClick={click}
        >
            {/* {getName(name)} */}
            {icon[name]}
        </IconStyle>
    );
}

Icon.propTypes = {
    name: string,
    color: string,
    size: string,
    bgColor: string,
    type: string,//可取large mini 默认为mini
    padding: string,
    click:func
}